#include <cstdio>
#include <cstring>

int N, M;
int G[105][105];

int main() {
	while (scanf("%d%d", &N, &M) == 2) {
		memset(G, 0x3F, sizeof(G));
		for (int i=0; i<M; i++) {
			int u, v;
			scanf("%d%d", &u, &v);
			G[u][v] = G[v][u] = 1;
		}
		for (int k=0; k<N; k++)
			for (int i=0; i<N; i++)
				for (int j=0; j<N; j++)
					if (G[i][k] + G[k][j] < G[i][j])
						G[i][j] = G[i][k] + G[k][j];
		
		bool flag = true;
		for (int i=0; i<N; i++) {
			for (int j=i+1; j<N; j++) {
				if (G[i][j] > 7) {
					flag = false;
					goto end;
				}
			}
		}
		end:
		if (flag) printf("Yes\n");
		else printf("No\n");
	}
	return 0;
}
